#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdio>
using namespace std;

int main()
{

    int n, m;
    scanf("%d%d", &n, &m);
    int a, b, c;
    int suma = 0, sumb = 0;
    scanf("%d%d%d", &a, &b, &c);
    if (a == 0)
    {
        suma++;
    }
    else if (a == 1)
    {
        sumb++;
    }
    if (b == 0)
    {
        suma++;
    }
    else if (b == 1)
    {
        sumb++;
    }
    if (c == 0)
    {
        suma++;
    }
    else if (c == 1)
    {
        sumb++;
    }
    if (n > m && suma != 0)
    {
        printf("The winner is a: %d + %d\n", n, suma);
    }
    else if (n > m && suma == 0)
    {
        printf("The winner is b: %d + %d\n", m, sumb);
    }
    else if (n < m && sumb == 0)
    {
        printf("The winner is a: %d + %d\n", n, suma);
    }
    else if (n < m && sumb != 0)
    {
        printf("The winner is b: %d + %d\n", m, sumb);
    }
    return 0;
}

